package com.dura.common.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
 * @version 1.0
 * @Author 振鹏
 * @Date 2025/3/18 17:05
 * @注释
 */
public class JsonUtil {
    private static ObjectMapper objectMapper = new ObjectMapper();

    public static String obj2JSON(Object obj){
        try {
            return objectMapper.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            throw new RuntimeException("转换JSON失败！");
        }
    }
}
